package com.fog.judge.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fog.judge.entity.QualitativeEvaluations;
import com.fog.judge.entity.Teacher;
import com.fog.judge.mapper.TeacherMapper;
import com.fog.judge.service.TeacherService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements TeacherService {

    @Override
    public List<Teacher> findByTeamId(int teamId) {
        LambdaQueryWrapper<Teacher> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Teacher::getTeamId, teamId);
        return this.baseMapper.selectList(queryWrapper);
    }

    @Override
    public Teacher getByTeacherId(int userId) {
        LambdaQueryWrapper<Teacher> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Teacher::getUserId, userId);
        return this.baseMapper.selectOne(queryWrapper);
    }
}
